package com.ftg.learn.service;


import com.ftg.learn.dao.Peijian;
import com.ftg.learn.mapper.PeijianMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PeijianService {

    @Autowired
    PeijianMapper peijianMapper;
    //显示全部
    public List<Peijian> select(int page, int limit, String name){
        int begin=(page-1)*limit;
        name=("".equals(name)?null:name);
        return peijianMapper.select(begin,limit,name);
    }
    //查一
    public int getCount(String name){
        name=("".equals(name)?null:name);
        return  peijianMapper.geletePeijian(name);
    }
    //添加
    public int add(Peijian peijian){
        return peijianMapper.add(peijian);
    }
    //删除
    public int delete(String id){
        return peijianMapper.delete(id);
    }
    //修改
    public int update(Peijian peijian){
        return peijianMapper.update(peijian);
    }

    public List<Peijian> selectpicture() {
        return peijianMapper.selectpicture();
    }
}
